var app = new Vue({
    el:"#app",
    data:{
        // 页面中需要使用到的数据，键值对
        answer : [],
        username: sessionStorage.username || localStorage.username,
        user_id: sessionStorage.user_id || localStorage.user_id,
        token: sessionStorage.token || localStorage.token,
        time:null,
        updatetime:null

    },

    computed:{
        // 需要通过计算得到的数据，键值对 ，键是名称，值是匿名函数
    },
    mounted:function () {
        id = get_query_string('id', 1)
        axios.get(base+'/question/'+id +"/",{
                headers: {
                    'Authorization': 'JWT ' + this.token
                },
                responseType: 'json'
                })
            .then(response=>{
                console.info(response.data),

                this.answer = response.data
                // for(var i=0;i<=(this.answer.length-1);i++){
                this.time = new Date(this.answer.update_time),
                this.updatetime = new Date(this.answer.subs[0].update_time)

                // this.updatetime = new Date(this.answer[i].update_time)
                // }
                // alert(this.time)
                // alert(this.updatetime)


            })
            .catch(error =>{
                //
                // alert('出错了')
            })


            },
    methods:{

    }
})/**
 * Created by python on 18-11-9.
 */
